#!/bin/bash

SERV_FTP_DIR="vsftpd"

TAP=tap4

if [ $UID != 0 ]; then
    echo "Debe estar logueado como Superusuario para levantar este servicio."
    exit 1
fi

echo "Cargando tabla ruteo"
# Servidor FTP pertenece a red Flash
# Tablas de ruteo
# Sale todo por R12
# Red Aquaman
route add -net 194.210.31.0 netmask 255.255.255.0 gw 10.11.25.2 $TAP

# Red Batman
route add -net 10.58.6.224 netmask 255.255.255.240 gw 10.11.25.2 $TAP

# Red Catwoman
route add -net 10.58.7.128 netmask 255.255.255.192 gw 10.11.25.2 $TAP

# Red Emma Frost
route add -net 10.58.7.192 netmask 255.255.255.240 gw 10.11.25.2 $TAP

# Red Green Lantern
route add -net 10.111.25.128 netmask 255.255.255.128 gw 10.11.25.2 $TAP

# Red Joker
route add -net 10.58.6.160 netmask 255.255.255.224 gw 10.11.25.2 $TAP

# Red Lux Luthor
route add -net 10.58.5.0 netmask 255.255.255.0 gw 10.11.25.2 $TAP

# Red Magneto
route add -net 10.158.6.128 netmask 255.255.255.224 gw 10.11.25.2 $TAP

# Redes NightCrawler
route add -net 10.58.7.216 netmask 255.255.255.252 gw 10.11.25.2 $TAP
route add -net 10.58.7.220 netmask 255.255.255.252 gw 10.11.25.2 $TAP
route add -net 10.58.7.224 netmask 255.255.255.252 gw 10.11.25.2 $TAP
route add -net 10.58.7.228 netmask 255.255.255.252 gw 10.11.25.2 $TAP
route add -net 10.58.7.232 netmask 255.255.255.252 gw 10.11.25.2 $TAP
route add -net 10.58.7.236 netmask 255.255.255.252 gw 10.11.25.2 $TAP
route add -net 10.58.7.240 netmask 255.255.255.252 gw 10.11.25.2 $TAP

# Red Quicksilver
route add -net 10.58.6.192 netmask 255.255.255.224 gw 10.11.25.2 $TAP

echo "Tabla ruteo cargada"


echo "Inicialización de Servicio FTP"
echo "******************************"
echo ""
echo "Instalando Servicio"
echo ""
apt-get install -y vsftpd

echo ""
echo "Configurando Servicio"
echo ""
service $SERV_FTP_DIR stop

cp ./vsftpd.conf /etc

service $SERV_FTP_DIR start

echo ""
echo "Fin de Inicialización de Servicio FTP"
echo "*************************************"
